home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Disk / Directory / error.c < prev    next >
Encoding:
Text File  |  1993-02-03  |  574 b   |  41 lines  |  [TEXT/KAHL]

  1. //-- Error.c
  2.  
  3. // Error management routines.
  4.  
  5. #include <unix.h>
  6. #include <stdio.h>
  7. #include "error.h"
  8. #include "res.h"
  9.  
  10. jmp_buf callStack[MAXJUMP];
  11. short callStackPtr;
  12.  
  13. //-- Throw
  14.  
  15. // This 'throws' the error message back to the 'catch' routine.
  16.  
  17. void Throw(i)
  18. int i;
  19. {
  20.     if (callStackPtr > 0) {
  21.         callStackPtr--;
  22.         longjmp(callStack[callStackPtr],i);
  23.     }
  24. }
  25.  
  26.  
  27.  
  28. //-- PostError
  29.  
  30. // This posts the error message specified to the screen.
  31.  
  32. void PostError(i)
  33. int i;
  34. {
  35.     char buffer[255];
  36.  
  37.     GetIndString(buffer,ERRORSTRS,i);
  38.     ParamText(buffer,NULL,NULL,NULL);
  39.     Alert(ERRORALRT,NULL);
  40. }
  41.